package com.liwujie.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liwujie.common.bean.PageBean;
import com.liwujie.common.crud.BaseServiceImpl;
import com.liwujie.bean.Customer;
import com.liwujie.mapper.CustomerMapper;
import com.liwujie.query.CustomerQuery;
import com.liwujie.service.CustomerService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomerServiceImpl extends BaseServiceImpl<Customer, CustomerMapper> implements CustomerService {
    //分页查询
    @Override
    public PageBean query(CustomerQuery query) {
        PageHelper.startPage(query.getPage(), query.getPageSize());//后面紧跟查询
        List list = baseMapper.query(query);
        PageInfo info = new PageInfo(list);
        return new PageBean(query.getPage(),query.getPageSize(),info.getTotal(),list);
    }
}
